var dialog = {
	error : function(message){
		layer.open({
			content: message,
			icon: 2,
			title: '错误提示',
		});
	},
	success : function(message,url){
		layer.open({
			content: message,
			icon: 1,
			yes: function(){
				location.href=url;
			},
		});
	},
	confirm : function(message,url){
		layer.open({
			content: message,
			icon: 3,
			btn : ['是','否'],
			yes: function(){
				location.href=url;
			},
		});
	},
	toconfirm : function(message){
		layer.open({
			content: message,
			icon: 3,
			btn : ['确定'],
		});
	},
	showPhoto:function(json){
		layer.photos({
			photos: json
			,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
		});
	},

	/*
	 *
	 */
    confirmWithFuntion : function(message,url, fun, onSuccess, onFail){
        var e = layer.open({
            content: message,
            icon: 3,
            btn : ['是','否'],
            yes: function(){
            	if (fun()) {
            		onSuccess();
                    if (e) layer.close(e);
				} else {
            		onFail();
            		if (e) layer.close(e);
				}
            }
        });
    },

}
